import {defineStore} from "pinia";
import {ref} from "vue";

export const usePermissStore=defineStore('permiss',()=>{
    const defaultList={
        admin:[
            '0',
            '1',
            '11',
            '12',
            '13',
            '2',
            '21',
            '22',
            '23',
            '24',
            '25',
            '26',
            '64',
            '65',
            '66',
            ],
        user:['0','1','11','12','13'],
    };
    const userInfo=localStorage.getItem("userInfo")
    const key=ref<string[]>([]);
    if (userInfo){
        key.value=(userInfo=='admin')?defaultList.admin:defaultList.user
    }
    const handleSet=(val:string[])=>{
        key.value=val
    }
    return{
            defaultList,
            key:(userInfo=='admin'?defaultList.admin:defaultList.user),
            handleSet
        }
})